import { UserTicket, UserRole, User } from "../model/user";

/**
 * 工作台登录接口
 */
export interface ServiceAuthLoginParams {
  phone: string;
  password: string;
  client?: 'worker_web' | 'worker_app';
}

export type ServiceAuthLoginRes = UserTicket;

/**
 * 工作台注册接口
 */
export interface ServiceAuthRegisterParams {
  phone: string;
  name: string;
  password: string;
  password_confirm: string;
  sms_code: string;
  /** 推荐码 */
  inviteCode: string;
  /** 微信登录openid */
  wxopenid?: string;
  /** 支付宝登录 */
  alipayUserId?: string;
}

/**
 * 返回 user_id 没有用途
 */
export type ServiceAuthRegisterRes = number;

/**
 * 更新用户资料
 */
export interface ServiceAuthUpdateUserInfoParams {
  user_id?: number;
  form: {
    id?: number;
    /** 是否开启手机端提示音 暂未实现 */
    voice?: number;
    avatar?: string;
    name?: string;
    /** 推送 */
    push_id?: string;
    /** 状态 */
    status?: number;
    /** 微信 */
    weixin_openid?: string;
    weixin_unionid?: string;
  };
}

/**
 * 为用户增加角色
 */
export interface ServiceAuthAddRoleParams {
  /** 使用手机号检索用户 */
  phone: number;
  type: UserRole['type'];
  shop_id: number;
}

/**
 * 获取店员列表
 */
export interface ServiceAuthGetUserListParams {
  currentPage?: number;
  pageSize?: number;
  count?: boolean;
  needRole?: boolean;
}

/**
 * 获取店员列表
 */
export interface ServiceAuthGetUserListRes1 {
  data: User[];
}
export type ServiceAuthGetUserListRes2 = User[];

/**
 * [API] 更新APP推送信息
 */
export interface ServiceAuthUpdatePushIdParams {
  push_id: string;
  app_os: 'ios' | 'android';
  app_version: number;
}

/**
 * [API] 通过短信验证码重置密码
 */
export interface ServiceAuthResetPasswordParams {
  phone: string;
  password: string;
  sms_code: string;
}
